package com.hqyj.controller;


import com.hqyj.anno.UserActionType;
import com.hqyj.pojo.KaoQin;
import com.hqyj.pojo.Score;
import com.hqyj.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

@Controller
@RequestMapping("grade")
public class gradeController {


    @Autowired
    ScoreService scoreService;


    @UserActionType(Ltype = "进入成绩界面",desc = "")
    @RequestMapping("gradePage")
    public String kaoqinPage() {
        return "grade/gradeList";
    }




    @UserActionType(Ltype = "进入成绩界面",desc = "执行查询记录操作")
    @RequestMapping("selectAll")
    @ResponseBody
    public HashMap<String, Object> selectAll(Score score) {
        return scoreService.selectAll(score);
    }

    //修改
    @UserActionType(Ltype = "进入成绩界面",desc = "执行修改记录操作")

    @RequestMapping(value = "update")
    @ResponseBody
    public HashMap<String, Object> updateByScid(Score score) {
        System.out.println("前端的值为"+score);
        return scoreService.updateByPrimaryKeySelective(score);
    }


    //删除

    @UserActionType(Ltype = "进入成绩界面",desc = "执行删除记录操作")

    @RequestMapping("delete")
    @ResponseBody
    public HashMap<String, Object> delete(Score score) {
        return scoreService.deleteByPrimaryKey(score.getScId());
    }

    //添加
    @UserActionType(Ltype = "进入成绩界面",desc = "执行添加记录操作")

    @RequestMapping("add")
    @ResponseBody
    public HashMap<String, Object> add(Score score) {
        System.out.println("新增接受传值:" + score);

        return scoreService.insertSelective(score);
    }

}
